﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebUtils;

namespace OAuth
{
    /// <summary>
    /// describes the service-provider specific behaviour
    /// </summary>
    public interface IServiceProvider
    {
        /// <summary>
        /// the complete request to be made for getting the requestToken request. Include special 
        /// parameters, authinfos etc
        /// </summary>
        IWebRequest RequestTokenRequest { get; }
        SignatureMethod RequestTokenSignatureMethod{get;}
        AuthInfoLocation RequestAuthInfoLocation{get;}

        /// <summary>
        /// the complete request to be made for getting the access token request. Include special
        /// paramecters, auth info etc
        /// </summary>
        IWebRequest AccessTokenRequest { get; }
        SignatureMethod AccessTokenSignatureMethod { get; }
        AuthInfoLocation AccessAuthInfoLocation{ get; }

        /// <summary>
        /// gives the services provider code a chance to do something with the response from the request token call. This
        /// must do the user redirection for the user to authorize the applitaion, IE, the library will not try to
        /// take the user to the service provider's authorization url
        /// </summary>
        /// <param name="pRequestTokenResponse"></param>
        /// <param name="pWebRequest"></param>
        void WithRequestTokenResult(string pRequestToken, string pRequestTokenSecret, IEnumerable<UnEncodedURLParameter> pAdditionalParameters);

        /// <summary>
        /// gives the consumer a chance to do additional work with the access token request response
        /// </summary>
        /// <param name="pAccessToken"></param>
        /// <param name="pAccessTokenSecret"></param>
        /// <param name="pAdditionalParameters"></param>
        void WithAccessTokenResult(string pAccessToken, string pAccessTokenSecret, IEnumerable<UnEncodedURLParameter> pAdditionalParameters);

        /// <summary>
        /// the signature method used for signing requests to protected resources
        /// </summary>
        SignatureMethod ProtectedResourceSignatureMethod { get; }

        /// <summary>
        /// Location of the authorization information for normal authorized resources requests
        /// </summary>
        AuthInfoLocation ProtectedResourceAuthInfoLocation { get; }
    }
}
